package com.example.mapper;

import com.example.domain.UrlResource;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;

@Repository
public class UrlResourceMapper {
    /**
     * 存放路径资源信息
     */
    private final List<UrlResource> resourceList = new ArrayList<>();

    @PostConstruct
    private void init(){
        resourceList.add(UrlResource.builder()
                .id(1L)
                .name("user:create")
                .url("/user/create")
                .build());
        resourceList.add(UrlResource.builder()
                .id(2L)
                .name("user:update")
                .url("/user/update")
                .build());
        resourceList.add(UrlResource.builder()
                .id(3L)
                .name("user:delete")
                .url("/user/delete/**")
                .build());
        resourceList.add(UrlResource.builder()
                .id(4L)
                .name("user:get")
                .url("/user/get/**")
                .build());
        resourceList.add(UrlResource.builder()
                .id(5L)
                .name("user:list")
                .url("/user/list")
                .build());
    }

    public List<UrlResource> getResourceList() {
        return resourceList;
    }
}
